package com.ceres.system.service.impl;

import com.ceres.system.dao.MenuMapper;
import com.ceres.system.pojo.Menu;
import com.ceres.system.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuMapper menuMapper;

    /**
     * 查询所有权限
     * @return
     */
    @Override
    public List<Menu> findAll(String category) {
        if ("0".equals(category)){
            List<Menu> menuList = menuMapper.findAllByCategory(category);
            return menuList;
        }
        if ("1".equals(category)){
            List<Menu> menuList = menuMapper.findAllByCategory(category);
            return menuList;
        }else {
            throw new RuntimeException("菜单参数错误");
        }
    }
}
